Imports agsXMPP
Imports agsXMPP.protocol.client
Imports agsXMPP.protocol.iq.roster

Namespace gtalkNotepad
	Public Class Contacts
		Inherits System.Collections.DictionaryBase

		Default Public Property Item(ByVal jid As String) As Contact
			Get
				Return CType(MyBase.Dictionary.Item(jid), Contact)
			End Get
			Set(ByVal value As Contact)
				MyBase.Dictionary.Item(jid) = value
			End Set
		End Property

		Public ReadOnly Property Jids() As String()
			Get
				Dim a(MyBase.Dictionary.Keys.Count - 1) As String
				MyBase.Dictionary.Keys().CopyTo(a, 0)
				Return a
			End Get
		End Property

		Public Event OnContactStatusChanged(ByVal sender As Object, ByVal status As Contact.ContactStatus)

		Public Sub Add(ByVal jid As String, ByVal value As Contact)
			MyBase.Dictionary.Add(jid, value)
			AddHandler value.OnStatusChange, AddressOf contact_onStatusChange
		End Sub

		Public Function ContainsJid(ByVal jid As String) As Boolean
			Return MyBase.Dictionary.Contains(jid)
		End Function

		Private Sub contact_onStatusChange(ByVal sender As Object, ByVal status As Contact.ContactStatus)
			RaiseEvent OnContactStatusChanged(sender, status)
		End Sub

	End Class
End Namespace
